home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 351-375 / 359 / dice / dice.lzh / lib / string / strstr.c < prev    next >
C/C++ Source or Header  |  1990-03-28  |  357b  |  26 lines

  1.  
  2. /*
  3.  *  STRSTR.C        find one string in another
  4.  *
  5.  *  (c)Copyright 1990, Matthew Dillon, All Rights Reserved
  6.  */
  7.  
  8. #include <string.h>
  9. #include <errno.h>
  10.  
  11. char *
  12. strstr(s1, s2)
  13. const char *s1;
  14. const char *s2;
  15. {
  16.     short len2 = strlen(s2);
  17.  
  18.     while (*s1) {
  19.     if (*s1 == *s2 && strncmp(s1, s2, len2) == 0)
  20.         return(s1);
  21.     ++s1;
  22.     }
  23.     return(NULL);
  24. }
  25.  
  26.